import torch
import numpy as np
import random


class Config(object):
    """配置参数"""

    def __init__(self):
        self.model_name = './model.pt'
        self.learning_rate = 1e-5  # 学习率
        self.hidden_size = 768
        self.bert_path = './bert_pretrain_en/'
        self.batch_size = 8  # 每批训练大小
        self.num_epochs = 5  # 总迭代轮次
        self.print_per_batch = 10  # 每多少轮输出一次结果

        self.total_num = 50000  # 数据集完整数据量
        self.label_num = 500  # 已有的百分百正确标签训练数据
        self.unlabel_num = 5000

        self.err_rate = 0.0  # 标签错误比例
        self.variance = 0.15

        """设置torch种子"""
        torch.manual_seed(4)
        torch.cuda.manual_seed(4)
        np.random.seed(4)
        random.seed(4)
        torch.backends.cudnn.deterministic = True

        """正则化"""
        self.weight_decay = 0.001

        """字向量归一化"""
        self.l2_norm_flag = True

        """fgm"""
        self.pifgm_flag = True

        """sce loss"""
        self.sce_flag = True
        self.sce_fgm_flag = True
        self.alpha = 1.0  # 0.1
        self.beta = 1.0
        self.A = -3.2  # 3.0 4.0 3.5

        self.semi_alpha = 0.37
        self.semi_beta = 0.1
